# istruzioni per stampare grafici relativi alle metriche degli IXP aggregate per continente


# 0) istruzioni generali:

set terminal jpeg enhanced linewidth 2
set xtics nomirror out autofreq
set ytics nomirror out autofreq
set border 3
set grid
unset xlabel
unset key

# directory in cui salvare i grafici
path = "./continent/"


# 1) istogrammi che mettono a confronto i continenti mediante varie metriche:

set style data histogram

# 1.1) numero di IXP per continente
#
set title "# of IXPs per Continent"
set output path."cont_num_ixp.jpg"
set ylabel "# IXP"
set ytics 5
plot '../C++/Result/gnuplot/gnuplot_ixp_agg.txt' using 2:xticlabels(1)
set ytics autofreq

# 1.2) numero medio di membri pubblici
#
set title "AVG # of Members in IXPs per Continent"
set output path."cont_member.jpg"
set ylabel "AVG # Members"
plot '../C++/Result/gnuplot/gnuplot_ixp_agg.txt' using 4:xticlabels(1)

# 1.3) numero medio di peering
#
set title "AVG # of Peerings in IXPs per Continent"
set output path."cont_peering.jpg"
set ylabel "AVG # Peerings"
plot '../C++/Result/gnuplot/gnuplot_ixp_agg.txt' using 6:xticlabels(1)

# 1.4) link density media
#
set title "AVG IXP Link Density per Continent"
set output path."cont_link_density.jpg"
set ylabel "AVG Link Density"
plot '../C++/Result/gnuplot/gnuplot_ixp_agg.txt' using 13:xticlabels(1)

# 1.5) out degree fraction media
#
set title "AVG AS ODF per Continent"
set output path."cont_odf.jpg"
set ylabel "AVG ODF"
plot '../C++/Result/gnuplot/gnuplot_ixp_agg.txt' using 21:xticlabels(1)


# 2) shell index ccdf:

set style data lines
set key
set xlabel "Shell Index Value"
set ylabel "CCDF"
set xtics 5
titolo = "Shell Index CCDF per Continent"

# 2.1) shell index ccdf di tutti i continenti considerando tutti gli ixp
#
set title titolo
set output path."cont_siccdf.jpg"
plot	'../C++/Result/gnuplot/gnuplot_siccdf_AF_0.txt' t "AF", \
		'../C++/Result/gnuplot/gnuplot_siccdf_EU_0.txt' t "EU", \
		'../C++/Result/gnuplot/gnuplot_siccdf_NA_0.txt' t "NA", \
		'../C++/Result/gnuplot/gnuplot_siccdf_AS_0.txt' t "AS", \
		'../C++/Result/gnuplot/gnuplot_siccdf_OC_0.txt' t "OC", \
		'../C++/Result/gnuplot/gnuplot_siccdf_LA_0.txt' t "LA"

# 2.2) shell index ccdf di tutti i continenti considerando gli ixp con RS togliendo il RS
#
set title titolo." (no RS)"
set output path."cont_siccdf_nors.jpg"
plot	'../C++/Result/gnuplot/gnuplot_siccdf_AF_1.txt' t "AF", \
		'../C++/Result/gnuplot/gnuplot_siccdf_EU_1.txt' t "EU", \
		'../C++/Result/gnuplot/gnuplot_siccdf_NA_1.txt' t "NA", \
		'../C++/Result/gnuplot/gnuplot_siccdf_AS_1.txt' t "AS", \
		'../C++/Result/gnuplot/gnuplot_siccdf_OC_1.txt' t "OC"

# 2.3) s.i. ccdf di tutti i continenti considerando gli ixp con RS formando una clique fra i peer del RS
#
set title titolo." (no RS w/ clique)"
set output path."cont_siccdf_norscli.jpg"
set xtics 20
plot	'../C++/Result/gnuplot/gnuplot_siccdf_AF_2.txt' t "AF", \
		'../C++/Result/gnuplot/gnuplot_siccdf_EU_2.txt' t "EU", \
		'../C++/Result/gnuplot/gnuplot_siccdf_NA_2.txt' t "NA", \
		'../C++/Result/gnuplot/gnuplot_siccdf_AS_2.txt' t "AS", \
		'../C++/Result/gnuplot/gnuplot_siccdf_OC_2.txt' t "OC"


# 3) link density ccdf:

set style data steps
set key
set xlabel "Link Density Value"
set ylabel "CCDF"
set xtics 0.1
set ytics 0.1
titolo = "Link Density CCDF per Continent"

# 3.1) link density ccdf di tutti i continenti considerando tutti gli ixp
#
set title titolo
set output path."cont_ldccdf.jpg"
plot	'../C++/Result/gnuplot/gnuplot_ldccdf_AF_0.txt' t "AF", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_EU_0.txt' t "EU" lt rgbcolor "green", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_NA_0.txt' t "NA" lt rgbcolor "blue", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_AS_0.txt' t "AS", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_OC_0.txt' t "OC", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_LA_0.txt' t "LA"

# 3.2) link density ccdf di tutti i continenti considerando gli ixp con RS togliendo il RS
#
set title titolo." (no RS)"
set output path."cont_ldccdf_nors.jpg"
plot	'../C++/Result/gnuplot/gnuplot_ldccdf_AF_1.txt' t "AF", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_EU_1.txt' t "EU", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_NA_1.txt' t "NA", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_AS_1.txt' t "AS", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_OC_1.txt' t "OC"

# 3.3) l.d. ccdf di tutti i continenti considerando gli ixp con RS formando una clique fra i peer del RS
#
set title titolo." (no RS w/ clique)"
set output path."cont_ldccdf_norscli.jpg"
plot	'../C++/Result/gnuplot/gnuplot_ldccdf_AF_2.txt' t "AF", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_EU_2.txt' t "EU", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_NA_2.txt' t "NA", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_AS_2.txt' t "AS", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_OC_2.txt' t "OC"
		
# 3.4) link density ccdf di Europa e Nord America
#
set title "Link Density CCDF EU vs NA"
set output path."cont_ldccdf_EU_NA.jpg"
plot	'../C++/Result/gnuplot/gnuplot_ldccdf_EU_0.txt' t "EU" lt rgbcolor "green", \
		'../C++/Result/gnuplot/gnuplot_ldccdf_NA_0.txt' t "NA" lt rgbcolor "blue"

